﻿@using Microsoft.Extensions.Logging
@inject ILogger<Error> Logger
@inject AntDesign.MessageService MessageService

<CascadingValue Value="this">
    @ChildContent
</CascadingValue>

@code {
    [Parameter]
    public RenderFragment? ChildContent { get; set; }

    public async Task ProcessError(Exception ex)
    {
        Logger.LogError("Error:ProcessError - Type: {Type} Message: {Message}", ex.GetType(), ex.Message);

        if (ex is MsgException msg)
        {
            await MessageService.Error(ex.Message);
        }
    }
}